﻿@model  List<FTBS.Models.Entities.ShowTime>

    <div style="overflow:auto">
        <div>

        </div>
        @foreach (var item in Model)
        {
            <div>
                <div style="float: left; padding-left: 10px">
                    @{
                        string minutes = "";

                        if (item.Time.Minutes < 10)
                        {
                            minutes = "0" + item.Time.Minutes.ToString();
                        }

                        var currentHour = DateTime.Now.Hour;
                        var currentDay = DateTime.Now.Day;
                        var showtimeHour = item.Time.Hours;
                        var showtimeDay = item.Date.Day;

                        if (currentDay >= showtimeDay)
                        {
                            if (showtimeHour >= currentHour + 2)
                            {
                                    <button class="info">
                                        @Html.ActionLink(item.Time.Hours.ToString() + ":" + minutes, "BookingAFilmTicket", new { @showtimeId = item.ShowTimeId })
                                    </button>
                            }

                            if (showtimeHour < currentHour + 2)
                            {
                                    <button disabled>
                                        @item.Time.Hours.ToString():@minutes
                                    </button>
                            }
                        }
                    }
                </div>
            </div>
            
        }
    </div>
